<?php
include("dbconnect.php");

//get all records with an @ tag
//$q1 = "SELECT * FROM questions AS q JOIN polls_questions_link ON q.question_id=polls_questions_link.question_id WHERE polls_questions_link.poll_id=".$id." ORDER BY polls_questions_link.question_order";
$q = "SELECT r.rid, r.text, r.time
		FROM records AS r 
		WHERE r.version=1
		ORDER BY r.time";
//put records in array
//create calender array
$calArray=array();

$result = mysql_query($q) or die('Query failed: ' . mysql_error());
while($l = mysql_fetch_array($result, MYSQL_ASSOC)) {
	$calArray[] = [
		'id'=>$l[rid],
		'title'=>$l[rid],
		'start'=>$l[time],
		'url'=>'index.php?rid='.$l[rid],
	];	
}

//encode array
echo json_encode($calArray);

?>
